package com.atguigu.sugar.mapper;

import com.atguigu.sugar.bean.C3Bean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface TradeStatsMapper {
    
    @Select("SELECT sum(order_origin_total_amount)\n" +
        "FROM dws_trade_order_window\n" +
        "WHERE toYYYYMMDD(stt) = #{date}")
    Double selectTotalAmount(@Param("date") Integer date);
    
    
    @Select("SELECT\n" +
        "    spu_name,\n" +
        "    sum(order_amount) AS order_amount\n" +
        "FROM dws_trade_user_spu_order_window\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY spu_name")
    List<Map<String, Object>> gmvBySpu(@Param("date") Integer date);
    
    @Select("SELECT\n" +
        "    category3_name,\n" +
        "    sum(order_amount) AS order_amount\n" +
        "FROM dws_trade_user_spu_order_window\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY category3_name")
    List<C3Bean> gmvByC3(@Param("date") Integer date);
    
    
    
}
